<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="css/bootstrap.css">
    <link rel="stylesheet" href="css/login.css">
    <link rel="stylesheet" href="css/font-awesome.css">
    <script src="js/jquery.js"></script>
    <script src="js/bootstrap.js"></script>
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Saturn--配置中心管理平台登录</title>
    <style type="text/css">
    .banner {
       background: linear-gradient(to right,rgba(154,208,226,0.9),rgba(255,100,97,0.35));
   	}
    </style>
</head>
<body class="banner">
    <div>
        <div class="be-content pren">
            <div class="ioc_text">
            	<img src="images/saturn.png" alt="">Saturn配置管理中心
            </div>
            <div>
                <form action="login" id="loginForm">
                    <div class="br-content">
                         <div class="input-group mb-4 bootint">
                             <div class="input-group-prepend">
                                 <span class="input-group-text"><i class="fa fa-user"></i></span>
                             </div>
                             <input type="text" id="loginName" class="form-control" placeholder="登录账号">
                         </div>
                         <div class="input-group mb-4 bootint">
                             <div class="input-group-prepend">
                                 <span class="input-group-text"><i class="fa fa-unlock-alt"></i></span>
                             </div>
                             <input type="password" id="loginPassword" class="form-control" placeholder="登录密码">
                         </div>
                        <div style="padding-top: 10px">
                            <input type="button" class="btn" id="login" value="登录">
                        </div>
                        <div class="be-con">
                            <span>Saturn Config Center Verion:1.0.0</span>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</body>
<script>
$("#loginPassword").keyup(function(event){
	if(event.keyCode == 13){
		 $("#login").trigger("click");
	}
});
$("#login").click(function(){
    var loginName = $("#loginName").val(); 
    var loginPassword = $("#loginPassword").val();
    if(loginName==''){
        alert('请输入登录账号');
        return;
    }
    if(loginPassword==''){
        alert('请输入登录密码');
        return;
    }
    $.ajax( {  
    	url:'/login',// 跳转到 action  
    	data:{loginName:loginName,loginPassword:loginPassword},  
    	type:'post',  
    	cache:false,  
    	dataType:'json',  
    	success:function(result) {  
    		if( result.success ){
        		//登录成功
        		location.href = "/";
        	}else{
        		alert(result.respMsg);
        	}
    	},  
    	error : function() {  
    		alert("登录失败");  
    	}  
    });
});
if (top.location != self.location) top.location = self.location;
</script>
</html>